<?php

namespace App\Kuafu\WaiMai\Model;

use App\Kuafu\Base\Model\Traits\KfUid;
use App\Kuafu\WaiMai\Enum\WaiMaiDBEnum;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Kuafu\Base\Model\BaseModel;

class WaiMaiShopFinishSwitchModel extends BaseModel
{
    use HasFactory;
    use KfUid;

    protected $connection = 'mysqlWaiMaiAll';
    protected $table      = 'waimai_shop_finish_switch'; //表名
    protected $primaryKey = 'id';
    public    $timestamps = true;

    protected $fillable = [
        'shopId',
        'switch',
        'reservePrepare',
        'reserveFinish',
    ];

    public static function addData(int $shopId, int $switch, int $reservePrepare, int $reserveFinish)
    {
        return self::query()
                   ->updateOrCreate(
                       ['shopId' => $shopId],
                       [
                           'switch'          => $switch,
                           'reservePrepare'  => $reservePrepare,
                           'reserveFinish'   => $reserveFinish,
                       ]
                   );
    }

}
